<template>
  <div id="app">
    <router-view v-if="onLine"></router-view>
    <div v-else class="wllj_black">
      <img :src="PIC_URL + '/tlbypcWeb/dragonTiger/wllj_black.png'" />
    </div>
  </div>
</template>
<script>
export default {
  name: "app",
  data() {
    return {
      onLine: navigator.onLine,
    };
  },
  mounted() {
    window.addEventListener("online", this.updateOnlineStatus); // 网络由异常到正常时触发
    window.addEventListener("offline", this.updateOnlineStatus); // 网络由正常常到异常时触发
  },
  methods: {
    updateOnlineStatus(e) {
      const { type } = e;
      this.onLine = type === "online";
    },
  },
};
</script>
<style lang="scss">
#app {
  
  padding: 10px 0;
  margin: 0 auto;
  box-sizing: border-box;
  width: 1200px;
  .wllj_black {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 150px;
  }
}
</style>
